<%@LANGUAGE="VBSCRIPT"%>
 
<!--#include file="functions.asp" -->
<%
Dim EXIREG__tmpNum
EXIREG__tmpNum = "0"
if (Request.QueryString("Seqnum") <> "") then EXIREG__tmpNum = Request.QueryString("Seqnum")
%>
<%
set EXIREG = Server.CreateObject("ADODB.Recordset")
EXIREG.ActiveConnection = cn
if (request.querystring("Seqnum") <> "0") then
EXIREG.Source = "SELECT SEQNUM, REGNUM, INVNUM, INVSTATUS, VENDORID, INVRECDATE, INVDUEDATE, PAYMENTDATE, EMPCODE, DEPARTMENT, "_
& "INVCURRENCY, (SELECT EXCHANGERATE FROM EXCHRATE WHERE EXCHRATE.MP2CURRENCY=EXIREG.INVCURRENCY) AS FRATE,"_
& "CURRENCYSYMBOL, INVAMOUNT, REFORDER, COMPCODE, VATNUM, WHTNAME, VATRATE, PENALTY,(INVAMOUNT/10) AS VATAMOUNT,"_
& "WHTRATE, WHTAMOUNT, VATPAIDTOVENDOR,   (SELECT TOP 1 VENDOR.NAME  FROM VENDOR  WHERE VENDOR.VENDORID=EXIREG.VENDORID) AS VENDORNAME,    "_
& "(SELECT EMP.FIRSTNAME + ' '  + EMP.LASTNAME FROM dbo.EMP WHERE EMP.EMPCODE=EXIREG.EMPCODE) AS EMPNAME,  "_
& "NOTES  FROM dbo.EXIREG  WHERE INVSTATUS='PAID' AND SEQNUM=" + Replace(EXIREG__tmpNum, "'", "''") + " "
else
EXIREG.Source = "SELECT SEQNUM, REGNUM, INVSTATUS,INVNUM, VENDORID, INVRECDATE, INVDUEDATE, PAYMENTDATE, EMPCODE, DEPARTMENT, INVCURRENCY, (SELECT EXCHANGERATE FROM EXCHRATE WHERE EXCHRATE.MP2CURRENCY=EXIREG.INVCURRENCY) AS FRATE, CURRENCYSYMBOL, INVAMOUNT, PENALTY, (INVAMOUNT/10) AS VATAMOUNT,REFORDER, COMPCODE, VATNUM, WHTNAME, VATRATE, WHTRATE, WHTAMOUNT, VATPAIDTOVENDOR, (SELECT TOP 1 VENDOR.NAME  FROM VENDOR  WHERE VENDOR.VENDORID=EXIREG.VENDORID) AS VENDORNAME,  (SELECT EMP.FIRSTNAME + ' '  + EMP.LASTNAME FROM dbo.EMP WHERE EMP.EMPCODE=EXIREG.EMPCODE) AS EMPNAME, NOTES  FROM dbo.EXIREG WHERE INVSTATUS='PAID' "
end if
'EXIREG.CursorType = 0
'EXIREG.CursorLocation = 2
'EXIREG.LockType = 3
EXIREG.Open()
EXIREG_numRows = 0
%>
<%
'  *** Recordset Stats, Move To Record, and Go To Record: declare stats variables

' set the record count
EXIREG_total = EXIREG.RecordCount

' set the number of rows displayed on this page
If (EXIREG_numRows < 0) Then
  EXIREG_numRows = EXIREG_total
Elseif (EXIREG_numRows = 0) Then
  EXIREG_numRows = 1
End If

' set the first and last displayed record
EXIREG_first = 1
EXIREG_last  = EXIREG_first + EXIREG_numRows - 1

' if we have the correct record count, check the other stats
If (EXIREG_total <> -1) Then
  If (EXIREG_first > EXIREG_total) Then EXIREG_first = EXIREG_total
  If (EXIREG_last > EXIREG_total) Then EXIREG_last = EXIREG_total
  If (EXIREG_numRows > EXIREG_total) Then EXIREG_numRows = EXIREG_total
End If
%>
<%
' *** Move To Record and Go To Record: declare variables

Set MM_rs    = EXIREG
MM_rsCount   = EXIREG_total
MM_size      = EXIREG_numRows
MM_uniqueCol = ""
MM_paramName = ""
MM_offset = 0
MM_atTotal = false
MM_paramIsDefined = false
If (MM_paramName <> "") Then
  MM_paramIsDefined = (Request.QueryString(MM_paramName) <> "")
End If
%>
<%
' *** Move To Record: handle 'index' or 'offset' parameter

if (Not MM_paramIsDefined And MM_rsCount <> 0) then

  ' use index parameter if defined, otherwise use offset parameter
  r = Request.QueryString("index")
  If r = "" Then r = Request.QueryString("offset")
  If r <> "" Then MM_offset = Int(r)

  ' if we have a record count, check if we are past the end of the recordset
  If (MM_rsCount <> -1) Then
    If (MM_offset >= MM_rsCount Or MM_offset = -1) Then  ' past end or move last
      If ((MM_rsCount Mod MM_size) > 0) Then         ' last page not a full repeat region
        MM_offset = MM_rsCount - (MM_rsCount Mod MM_size)
      Else
        MM_offset = MM_rsCount - MM_size
      End If
    End If
  End If

  ' move the cursor to the selected record
  i = 0
  While ((Not MM_rs.EOF) And (i < MM_offset Or MM_offset = -1))
    MM_rs.MoveNext
    i = i + 1
  Wend
  If (MM_rs.EOF) Then MM_offset = i  ' set MM_offset to the last possible record

End If
%>
<%
' *** Move To Record: if we dont know the record count, check the display range

If (MM_rsCount = -1) Then

  ' walk to the end of the display range for this page
  i = MM_offset
  While (Not MM_rs.EOF And (MM_size < 0 Or i < MM_offset + MM_size))
    MM_rs.MoveNext
    i = i + 1
  Wend

  ' if we walked off the end of the recordset, set MM_rsCount and MM_size
  If (MM_rs.EOF) Then
    MM_rsCount = i
    If (MM_size < 0 Or MM_size > MM_rsCount) Then MM_size = MM_rsCount
  End If

  ' if we walked off the end, set the offset based on page size
  If (MM_rs.EOF And Not MM_paramIsDefined) Then
    If (MM_offset > MM_rsCount - MM_size Or MM_offset = -1) Then
      If ((MM_rsCount Mod MM_size) > 0) Then
        MM_offset = MM_rsCount - (MM_rsCount Mod MM_size)
      Else
        MM_offset = MM_rsCount - MM_size
      End If
    End If
  End If

  ' reset the cursor to the beginning
  If (MM_rs.CursorType > 0) Then
    MM_rs.MoveFirst
  Else
    MM_rs.Requery
  End If

  ' move the cursor to the selected record
  i = 0
  While (Not MM_rs.EOF And i < MM_offset)
    MM_rs.MoveNext
    i = i + 1
  Wend
End If
%>
<%
' *** Move To Record: update recordset stats

' set the first and last displayed record
EXIREG_first = MM_offset + 1
EXIREG_last  = MM_offset + MM_size
If (MM_rsCount <> -1) Then
  If (EXIREG_first > MM_rsCount) Then EXIREG_first = MM_rsCount
  If (EXIREG_last > MM_rsCount) Then EXIREG_last = MM_rsCount
End If

' set the boolean used by hide region to check if we are on the last record
MM_atTotal = (MM_rsCount <> -1 And MM_offset + MM_size >= MM_rsCount)
%>
<%
' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters

' create the list of parameters which should not be maintained
MM_removeList = "&index="
If (MM_paramName <> "") Then MM_removeList = MM_removeList & "&" & MM_paramName & "="
MM_keepURL="":MM_keepForm="":MM_keepBoth="":MM_keepNone=""

' add the URL parameters to the MM_keepURL string
For Each Item In Request.QueryString
  NextItem = "&" & Item & "="
  If (InStr(1,MM_removeList,NextItem,1) = 0) Then
    MM_keepURL = MM_keepURL & NextItem & Server.URLencode(Request.QueryString(Item))
  End If
Next

' add the Form variables to the MM_keepForm string
For Each Item In Request.Form
  NextItem = "&" & Item & "="
  If (InStr(1,MM_removeList,NextItem,1) = 0) Then
    MM_keepForm = MM_keepForm & NextItem & Server.URLencode(Request.Form(Item))
  End If
Next

' create the Form + URL string and remove the intial '&' from each of the strings
MM_keepBoth = MM_keepURL & MM_keepForm
if (MM_keepBoth <> "") Then MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)
if (MM_keepURL <> "")  Then MM_keepURL  = Right(MM_keepURL, Len(MM_keepURL) - 1)
if (MM_keepForm <> "") Then MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)

' a utility function used for adding additional parameters to these strings
Function MM_joinChar(firstItem)
  If (firstItem <> "") Then
    MM_joinChar = "&"
  Else
    MM_joinChar = ""
  End If
End Function
%>
<%
' *** Move To Record: set the strings for the first, last, next, and previous links

MM_keepMove = MM_keepBoth
MM_moveParam = "index"

' if the page has a repeated region, remove 'offset' from the maintained parameters
If (MM_size > 0) Then
  MM_moveParam = "offset"
  If (MM_keepMove <> "") Then
    params = Split(MM_keepMove, "&")
    MM_keepMove = ""
    For i = 0 To UBound(params)
      nextItem = Left(params(i), InStr(params(i),"=") - 1)
      If (StrComp(nextItem,MM_moveParam,1) <> 0) Then
        MM_keepMove = MM_keepMove & "&" & params(i)
      End If
    Next
    If (MM_keepMove <> "") Then
      MM_keepMove = Right(MM_keepMove, Len(MM_keepMove) - 1)
    End If
  End If
End If

' set the strings for the move to links
If (MM_keepMove <> "") Then MM_keepMove = MM_keepMove & "&"
urlStr = Request.ServerVariables("URL") & "?" & MM_keepMove & MM_moveParam & "="
MM_moveFirst = urlStr & "0"
MM_moveLast  = urlStr & "-1"
MM_moveNext  = urlStr & Cstr(MM_offset + MM_size)
prev = MM_offset - MM_size
If (prev < 0) Then prev = 0
MM_movePrev  = urlStr & Cstr(prev)
%>
<SCRIPT Language="JavaScript">
function DocLoad(){

}

</SCRIPT>
<!-- #include file="pagetop.asp" -->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr> 
    <td nowrap height="21" bgcolor="#FFFFFF" width="3%" background="images/menu_end.gif">&nbsp;</td>
    <td nowrap height="21" bgcolor="#FFFFFF" width="28"> 
      <div align="center"><img src="images/menu_awal_off.gif" width="28" height="33"></div>
    </td>
    <td width="15%" background="images/menuoff.gif" height="21" nowrap> 
      <div align="center"><b><a href="InvSumList.asp?Order=<%= request.querystring("order") %>&Sort=<%= request.querystring("sort") %>" class="menu">Invoice 
        List</a></b></div>
    </td>
    <td nowrap height="21" width="28"><img src="images/menu_off_on_separator.gif" width="28" height="33"></td>
    <td width="15%" background="images/menuon.gif" height="21" nowrap> 
      <div align="center"><b class="menu">Payment Summary</b></div>
    </td>
    <td height="21" bgcolor="#FFFFFF" width="11"><img src="images/Menu_onend.gif" width="13" height="33"></td>
    <td height="21" bgcolor="#FFFFFF" background="images/menu_end.gif"> 
      <div align="right"><b><font color="#003399">Invoice Summary</font></b> </div>
    </td>
  </tr>
  <tr bgcolor="#93bee2"> 
    <td height="21" width="3%" bgcolor="#93bee2">&nbsp;</td>
    <td height="21" width="28" bgcolor="#93bee2">&nbsp;</td>
    <td width="15%" height="21" bgcolor="#93bee2">&nbsp;</td>
    <td height="21" width="28">&nbsp;</td>
    <td width="15%" height="21">&nbsp;</td>
    <td height="21">&nbsp;</td>
    <td height="21">&nbsp;</td>
  </tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#93bee2">
  <tr> 
    <td width="4%">&nbsp;</td>
    <td width="2%">&nbsp;</td>
    <td> 
      <table border="0" width="50%" align="left">
        <tr> 
          <td width="23%" align="center"> <b> 
            <% If MM_offset <> 0 Then %>
            <a href="<%=MM_moveFirst%>">&lt;&lt; 
            First</a> 
            <% End If ' end MM_offset <> 0 %>
            </b></td>
          <td width="31%" align="center"> <b> 
            <% If MM_offset <> 0 Then %>
            <a href="<%=MM_movePrev%>">&lt; 
            Previous</a> 
            <% End If ' end MM_offset <> 0 %>
            </b></td>
          <td width="23%" align="center"> <b> 
            <% If Not MM_atTotal Then %>
            <a href="<%=MM_moveNext%>">Next 
            &gt; </a> 
            <% End If ' end Not MM_atTotal %>
            </b></td>
          <td width="23%" align="center"> <b> 
            <% If Not MM_atTotal Then %>
            <a href="<%=MM_moveLast%>">Last 
            &gt;&gt; </a> 
            <% End If ' end Not MM_atTotal %>
            </b></td>
        </tr>
      </table>
    </td>
  </tr>
  <tr> 
    <td width="4%">&nbsp;</td>
    <td width="2%">&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr> 
    <td width="4%">&nbsp;</td>
    <td width="2%" bgcolor="#FFFFFF"><img src="images/curv_data.gif" width="21" height="21"></td>
    <td bgcolor="#FFFFFF">&nbsp;</td>
  </tr>
  <tr> 
    <td width="4%">&nbsp;</td>
    <td width="2%" bgcolor="#FFFFFF">&nbsp;</td>
    <td bgcolor="#FFFFFF"> 
      <form name="form1" method="post" action="Inv_Process.asp" onSubmit="return checkrequired(this)">
        <table width="100%" border="0" cellspacing="2" cellpadding="3">
          <tr> 
            <td width="15%" bgcolor="#dedede" height="25"> 
              <div align="right"><b>Register No.:&nbsp;</b></div>
            </td>
            <td width="2%" height="25">&nbsp;</td>
            <td width="30%" height="25"> <%=(EXIREG.Fields.Item("REGNUM").Value)%> </td>
            <td width="15%" bgcolor="#dedede" height="25"> 
              <div align="right"><b>Invoice No.:&nbsp;</b></div>
            </td>
            <td width="2%" height="25">&nbsp;</td>
            <td height="25"> <%=(EXIREG.Fields.Item("INVNUM").Value)%> </td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#dedede" height="25"> 
              <div align="right"><b>Vendor ID:&nbsp;</b></div>
            </td>
            <td width="2%" height="25">&nbsp;</td>
            <td width="30%" height="25"> <%=(EXIREG.Fields.Item("VENDORID").Value)%> </td>
            <td width="15%" bgcolor="#dedede" height="25"> 
              <div align="right"><b>Status:&nbsp;</b></div>
            </td>
            <td width="2%" height="25">&nbsp;</td>
            <td bgcolor="#FFFFFF" height="25"> <%=(EXIREG.Fields.Item("INVSTATUS").Value)%> </td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#dedede" height="25"> 
              <div align="right"><b>Vendor Name:&nbsp;</b></div>
            </td>
            <td width="2%" height="25">&nbsp;</td>
            <td colspan="4" height="25"> <%=(EXIREG.Fields.Item("VENDORNAME").Value)%> </td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#dedede" height="25"> 
              <div align="right"><b>Received Date:&nbsp;</b></div>
            </td>
            <td width="2%" height="25">&nbsp;</td>
            <td width="30%" height="25"> <%= DoDateTime((EXIREG.Fields.Item("INVRECDATE").Value), 1, 2057) %> </td>
            <td width="15%" bgcolor="#dedede" height="25"> 
              <div align="right"><b>Due Date:&nbsp;</b></div>
            </td>
            <td width="2%" height="25">&nbsp;</td>
            <td height="25"> <%= DoDateTime((EXIREG.Fields.Item("INVDUEDATE").Value), 1, 2057) %> </td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#dedede" height="25"> 
              <div align="right"><b>Received By:&nbsp;</b></div>
            </td>
            <td width="2%" height="25">&nbsp;</td>
            <td width="30%" height="25"> <%=(EXIREG.Fields.Item("EMPCODE").Value)%> </td>
            <td width="15%" bgcolor="#dedede" height="25"> 
              <div align="right"><b>Payment Date:&nbsp;</b></div>
            </td>
            <td width="2%" height="25">&nbsp;</td>
            <td height="25"> <%= DoDateTime((EXIREG.Fields.Item("PAYMENTDATE").Value), 1, 2057) %> </td>
          </tr>
          <tr> 
            <td width="15%" height="25">&nbsp;</td>
            <td width="2%" height="25">&nbsp;</td>
            <td width="30%" height="25"><%=(EXIREG.Fields.Item("EMPNAME").Value)%></td>
            <td width="15%" height="25">&nbsp;</td>
            <td width="2%" height="25">&nbsp;</td>
            <td height="25">&nbsp;</td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#dedede" height="25"> 
              <div align="right"><b>WHT Name:&nbsp;</b></div>
            </td>
            <td width="2%" height="25">&nbsp;</td>
            <td width="30%" height="25"><%=(EXIREG.Fields.Item("WHTNAME").Value)%></td>
            <td width="15%" bgcolor="#dedede" height="25"> 
              <div align="right"><b>WHT Rate:&nbsp;</b></div>
            </td>
            <td width="2%" height="25">&nbsp;</td>
            <td height="25"><%=(EXIREG.Fields.Item("WHTRATE").Value)%></td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#dedede" height="25"> 
              <div align="right"><b>VAT Rate:&nbsp;</b></div>
            </td>
            <td width="2%" height="25">&nbsp;</td>
            <td width="30%" height="25"><%=(EXIREG.Fields.Item("VATRATE").Value)%></td>
            <td width="15%" bgcolor="#dedede" height="25"> 
              <div align="right"><b>Exchange Rate:&nbsp;</b></div>
            </td>
            <td width="2%" height="25">&nbsp;</td>
            <td height="25"><%= FormatNumber((EXIREG.Fields.Item("FRATE").Value), -1, -2, -2, -1) %></td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#dedede" height="25"> 
              <div align="right"><b>Currency:&nbsp;</b></div>
            </td>
            <td width="2%" height="25">&nbsp;</td>
            <td width="30%" height="25"><%=(EXIREG.Fields.Item("INVCURRENCY").Value)%></td>
            <td width="15%" bgcolor="#dedede" height="25">&nbsp;</td>
            <td width="2%" height="25">&nbsp;</td>
            <td height="25">&nbsp;</td>
          </tr>
          <tr valign="middle"> 
            <td width="15%" height="25"> 
              <div align="right"></div>
            </td>
            <td width="2%" height="25">&nbsp;</td>
            <td width="30%" height="25"> 
              <% if (EXIREG.Fields.Item("VATPAIDTOVENDOR").Value="Y") then  %>
              <img src="images/check.jpg" width="18" height="17"> 
              <% else %>
              <img src="images/uncheck.jpg" width="14" height="14"> 
              <% end if %>
              VAT Paid To Vendor </td>
            <td width="15%" height="25"> 
              <div align="right"></div>
            </td>
            <td width="2%" height="25">&nbsp;</td>
            <td height="25">&nbsp;</td>
          </tr>
          <tr> 
            <td width="15%" height="25"> 
              <div align="right"></div>
            </td>
            <td width="2%" height="25">&nbsp;</td>
            <td width="30%" height="25">&nbsp; </td>
            <td width="15%" height="25"> 
              <div align="right"></div>
            </td>
            <td width="2%" height="25">&nbsp;</td>
            <td height="25">&nbsp; </td>
          </tr>
        </table>
		  
        <table width="100%" border="0" cellspacing="2" cellpadding="3">
          <tr> 
            <td width="15%" bgcolor="#FFFFFF"><b>Payment Summary:</b></td>
            <td width="2%">&nbsp;</td>
            <td width="15%">&nbsp;</td>
            <td width="2%" valign="bottom"> 
              <div align="center"></div>
            </td>
            <td width="15%"> 
              <div align="right"></div>
            </td>
            <td>&nbsp;</td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#dedede" height="25"> 
              <div align="right"><b>Invoice Amount:&nbsp;</b></div>
            </td>
            <td width="2%" height="25">&nbsp;</td>
            <td height="25" width="15%"> 
              <div align="right">&nbsp;<%= FormatNumber((EXIREG.Fields.Item("INVAMOUNT").Value), -1, -2, -2, -1) %></div>
            </td>
            <td height="25" width="2%" valign="bottom"> 
              <div align="center"></div>
            </td>
            <td height="25" width="15%"> 
              <div align="right"></div>
            </td>
            <td height="25"> </td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#dedede" height="25"> 
              <div align="right"><b>VAT 10% :&nbsp;</b></div>
            </td>
            <td width="2%" height="25">&nbsp;</td>
            <td height="25" width="15%"> 
              <div align="right">&nbsp;<%= FormatNumber((EXIREG.Fields.Item("VATAMOUNT").Value), -1, -2, -2, -1) %></div>
            </td>
            <td height="25" width="2%" valign="bottom"> 
              <div align="center">+</div>
            </td>
            <td height="25" width="15%"> 
              <div align="right"></div>
            </td>
            <td height="25"></td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#FFFFFF" height="25">&nbsp;</td>
            <td width="2%" height="25">&nbsp;</td>
            <td width="15%" background="images/line.gif" height="25">&nbsp;</td>
            <td width="2%" valign="bottom" height="25"> 
              <div align="center"></div>
            </td>
            <td width="15%" height="25"> 
              <div align="right"><%= FormatNumber((EXIREG.Fields.Item("INVAMOUNT").Value + EXIREG.Fields.Item("VATAMOUNT").Value), -1, -2, -2, -1) %></div>
            </td>
            <td height="25"></td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#dedede" height="25"> 
              <div align="right"><b>Penalty:&nbsp;</b></div>
            </td>
            <td width="2%" height="25">&nbsp;</td>
            <td height="25" width="15%"> 
              <div align="right">&nbsp;<%= FormatNumber((EXIREG.Fields.Item("PENALTY").Value), -1, -2, -2, -1) %> </div>
            </td>
            <td height="25" width="2%" valign="bottom"> 
              <div align="center">-</div>
            </td>
            <td height="25" width="15%"> 
              <div align="right"></div>
            </td>
            <td height="25"></td>
          </tr>
          <tr> 
            <td width="15%" height="25">&nbsp;</td>
            <td width="2%" height="25">&nbsp;</td>
            <td background="images/line.gif" width="15%" height="25">&nbsp;</td>
            <td width="2%" valign="bottom" height="25"> 
              <div align="center"></div>
            </td>
            <td width="15%" height="25"> 
              <div align="right"><%= FormatNumber((EXIREG.Fields.Item("INVAMOUNT").Value + EXIREG.Fields.Item("VATAMOUNT").Value-EXIREG.Fields.Item("PENALTY").Value), -1, -2, -2, -1) %></div>
            </td>
            <td height="25"></td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#dedede" height="25"> 
              <div align="right"><b>WHT Amount:&nbsp;</b></div>
            </td>
            <td width="2%" height="25">&nbsp;</td>
            <td height="25" width="15%"> 
              <div align="right">&nbsp;<%= FormatNumber((EXIREG.Fields.Item("WHTAMOUNT").Value), -1, -2, -2, -1) %></div>
            </td>
            <td height="25" width="2%" valign="bottom"> 
              <div align="center">-</div>
            </td>
            <td height="25" width="15%"> 
              <div align="right"></div>
            </td>
            <td height="25"> </td>
          </tr>
          <tr> 
            <td width="15%" height="25">&nbsp;</td>
            <td width="2%" height="25">&nbsp;</td>
            <td width="15%" background="images/line.gif" height="25">&nbsp;</td>
            <td width="2%" valign="bottom" height="25"> 
              <div align="center"></div>
            </td>
            <td width="15%" height="25"> 
              <div align="right"><%= FormatNumber((EXIREG.Fields.Item("INVAMOUNT").Value + EXIREG.Fields.Item("VATAMOUNT").Value-EXIREG.Fields.Item("PENALTY").Value-EXIREG.Fields.Item("WHTAMOUNT").Value), -1, -2, -2, -1) %></div>
            </td>
            <td height="25">&nbsp;</td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#dedede" height="25"> 
              <div align="right"><b>Grand Total:&nbsp;</b></div>
            </td>
            <td width="2%" height="25">&nbsp;</td>
            <td width="15%" height="25"><b></b></td>
            <td height="25" width="2%" valign="bottom"> 
              <div align="center"><b></b></div>
            </td>
            <td height="25" width="15%" background="images/dbl_line.gif"> 
              <div align="right"><b><%= FormatNumber((EXIREG.Fields.Item("INVAMOUNT").Value + EXIREG.Fields.Item("VATAMOUNT").Value-EXIREG.Fields.Item("PENALTY").Value-EXIREG.Fields.Item("WHTAMOUNT").Value), -1, -2, -2, -1) %></b></div>
            </td>
            <td height="25">&nbsp;</td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#FFFFFF" height="25">&nbsp;</td>
            <td width="2%" height="25">&nbsp;</td>
            <td width="15%" height="25">&nbsp;</td>
            <td height="25" width="2%" valign="bottom"> 
              <div align="center"></div>
            </td>
            <td height="25" width="15%"> 
              <div align="right"></div>
            </td>
            <td height="25">&nbsp;</td>
          </tr>
        </table>
      </form>
    </td>
  </tr>
  <tr> 
    <td width="4%">&nbsp;</td>
    <td width="2%" bgcolor="#FFFFFF">&nbsp;</td>
    <td bgcolor="#FFFFFF">&nbsp;</td>
  </tr>
</table>
</body>
</html>
<%
EXIREG.Close()
%>
